package com.ff.discounts.component.saleorder

import android.os.Bundle
import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.ff.discounts.R
import com.ff.discounts.component.tab.home.HistoryData
import com.ff.discounts.databinding.RecyclerViewBinding
import com.ff.discounts.fragment.BaseViewModelFragment
import com.ff.discounts.library.log.HiLog
import com.ff.discounts.util.Constant

/**
 *订单界面
 * @author: fufang
 * @date: 2023/11/2
 */
class OrderSaleFragment:BaseViewModelFragment<RecyclerViewBinding>() {
    private lateinit var adapter:SaleOrderAdapter

    override fun initDatum() {
        super.initDatum()
        adapter = SaleOrderAdapter()
        binding.list.adapter = adapter
        adapter.submitList(OrderSaleFragment.HotList)
    }

    override fun initListeners() {
        super.initListeners()
        adapter.setOnItemClickListener{ adpter: BaseQuickAdapter<HistoryData, *>, view: View, positn: Int ->
               val data = adpter.getItem(positn)
               HiLog.d(data)
        }
    }

    companion object{
        fun newInstance(status:Int):OrderSaleFragment{
            val args = Bundle()
            args.putInt(Constant.STYLE,status)
            val fragment = OrderSaleFragment()
            fragment.arguments = args
            return fragment
        }

        private val HotList = mutableListOf<HistoryData>(
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集")
        )


    }

}